//
//  AppMarco.h
//  CJMobile
//
//  Created by manluqiusuo on 15/9/16.
//  Copyright (c) 2015年 长江证券. All rights reserved.
//

#ifndef CJMOBILE_APP_MARCO
#define CJMOBILE_APP_MARCO


//定义友盟KEY
#define UMENG_APPKEY @""


#if DEBUG
#define DSSHLog(format, ...) NSLog((@"[文件名:%s]" "[函数名:%s]" "[行号:%d]" format), __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DSSHLog(...);
#endif

//定义缩放比例
#define WIDTH_SCALE (ZYAppWidth / 375.0)
#define HIGHT_SCALE (ZYAppHeight / 667.0)
//定义常用尺寸
#define ZYScreenBounds  [[UIScreen mainScreen] bounds]
#define ZYScreenFrame   [[UIScreen mainScreen] applicationFrame]
#define ZYAppWidth      [[UIScreen mainScreen] bounds].size.width
#define ZYAppHeight     [[UIScreen mainScreen] bounds].size.height

//定义字体函数
#define FONT(a)  [UIFont systemFontOfSize:a ]
#define BFONT(a) [UIFont boldSystemFontOfSize:a ]

//定义颜色函数
#define RGBA(r,g,b,a)   [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a]
#define RGBCOLOR(a,b,c) RGBA(a,b,c,1.0)
#define XRGB(r,g,b)     [UIColor colorWithRed:(0x##r)/255.0 green:(0x##g)/255.0 blue:(0x##b)/255.0 alpha:1]

#define BACKGROUD_COLOR  [UIColor whiteColor]
//定义常用的字符串函数



//定义版本相关的宏
#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)


//系统标准保存键值
#define UserDefaultStandard  [NSUserDefaults standardUserDefaults]


//顶部导航栏文字大小以及颜色
#define FONT_NAVIGATE_BAR_TITLE    BFONT(17)
#define FONT_NAVIGATE_BUTTON_ITEM  FONT(15)
#define COLOR_NAVIGATE_BAR         XRGB(223,48,49)
#define COLOR_NAVIGATE_BAR_TITLE   XRGB(FF,FF,FF)

//底部Tab栏
#define COLOR_TAB_BAR_BACKGROUND   XRGB(f8,f8,f7)

//用户详情中姓名字体
#define FONT_SIZE_CONTACT_DETAIL_NAME  FONT(16)
#define FONT_COLOR_CONTACT_DETAIL_NAME XRGB(29,29,29)

//用户详情部门字体
#define FONT_SIZE_CONTACT_DETAIL_DEPT  FONT(13)
#define FONT_COLOR_CONTACT_DETAIL_DEPT XRGB(29,29,29)


//列表主要内容字体大小及颜色
#define FONT_SIZE_TABLE_VIEW_CONTENT  FONT(14)
#define FONT_SIZE_TABLE_VIEW_MINI     FONT(12)
#define FONT_COLOR_TABLE_VIEW_CONTENT XRGB(29,29,29)

//按钮字体大小及颜色
#define FONT_SIZE_BUTTON_TITLE  FONT(13)
#define FONT_COLOR_BUTTON_TITLE XRGB(29,29,29)

//聊天文字大小及颜色
#define FONT_SIZE_CHAT         FONT(14)
#define FONT_COLOR_SELF_CHAT   XRGB(29,29,29)
#define FONT_COLOR_OTHER_CHAT  XRGB(29,29,29)

//地理位置、聊天时间等次要文字
#define FONT_SIZE_TIME_CHAT    FONT(11)
#define FONT_COLOR_TIME_CHAT   XRGB(C5,C5,C5)

//列表中的时间
#define FONT_SIZE_TABLE_VIEW_TIME  FONT(10)
#define FONT_COLOR_TABLE_VIEW_TIME XRGB(C5,C5,C5)


//灰色的字
#define FONT_COLOR_BLACK XRGB(05,05,05)
#define FONT_COLOR_GRAY  XRGB(9a,9a,9a)


//通用的尺寸
#define TABLE_VIEW_GROUP_HEADER_HEIGHT   20 * WIDTH_SCALE
#define TABLE_VIEW_CELL_HEIGHT           40 * WIDTH_SCALE
#define TABLE_VIEW_CELL_IMG_HEIGHT       25 * WIDTH_SCALE
#define TABLE_VIEW_CELL_TOP_SPACE       7.5 * WIDTH_SCALE
#define TABLE_VIEW_CELL_LEFT_SPACE       10 * WIDTH_SCALE
#define TABLE_VIEW_CELL_RIGHT_SPACE      10 * WIDTH_SCALE
#define TABLE_VIEW_CELL_RIGHT_SPACE_BIG  30 * WIDTH_SCALE  //用于带>的cell
#define PIC_ROUND_RADIUS                 3  * WIDTH_SCALE
#define LABLE_HEIGHT_NORMAL              20 * WIDTH_SCALE


//个人中心
#define TABLE_VIEW_CELL_HEIGHT_CONTACT_DETAIL   80 * WIDTH_SCALE
#define PIC_SIZE_CONTACT_DETAIL                 65 * WIDTH_SCALE
#define TABLE_VIEW_CELL_RIGHT_LABEL_WIDTH      100 * WIDTH_SCALE


#define TABLE_VIEW_CELL_HEIGHT_CHAT_LIST        65 * WIDTH_SCALE


//操作按钮大小
#define BUTTON_HEIGHT_FOR_DML       40 * WIDTH_SCALE
#define BUTTON_TOP_SPACE_FOR_DML    20 * WIDTH_SCALE

//通讯录图像大小
#define PIC_SIZE_CONTACT_LIST           35 * WIDTH_SCALE
#define CONTACT_TABLE_VIEW_CELL_HEIGHT  50 * WIDTH_SCALE
#define CONTACT_NAME_LABEL_WIDTH        50 * WIDTH_SCALE

//聊天主界面
#define PIC_SIZE_CHAT_LIST      45 * WIDTH_SCALE



//用户详情UI
#define TABLE_VIEW_TOP_SPACE_NORMAL      7.5 * WIDTH_SCALE
#define TABLE_VIEW_TOP_SPACE_BIG         15 * WIDTH_SCALE
#define TABLE_VIEW_TOP_SPACE_SMALL        5 * WIDTH_SCALE
#define BUTTON_SIZE_CONTACT_DETAIL_EDIT  30 * WIDTH_SCALE



/****************************UI规范************************************/



#define KEY_FOR_IM_DISTURB_IN_USER_DEFAULTS @"KEY_FOR_IM_DISTURB_IN_USER_DEFAULTS"


//待整理宏

//-------------------------------------------------------------------------------------------------------------
//
// TABLEVIEW用到的常量
//
//-------------------------------------------------------------------------------------------------------------
#define TABLEVIEW_GROUP_TYPE_SEARCH         1


#define TABLEVIEW_CELL_TYPE_SEARCH          1
#define TABLEVIEW_CELL_TYPE_SEARCH_TIP      2


//-------------------------------------------------------------------------------------------------------------
//
// UI规范
//
//-------------------------------------------------------------------------------------------------------------
#define UI_HIGHT_STATUS_BAR                   20
#define UI_HIGHT_NAVIGATION_BAR               44
#define UI_HIGHT_TAB_BAR                      49
#define UI_HIGHT_SEARCH_BAR                   38
#define UI_FONT_NAVIGATION_BAR_TITLE          18
#define UI_FONT_NAVIGATION_BAR_BUTTON         14

#define UI_SIZE_TABLE_CELL_SEARCH_TIP         216
#define UI_HIGHT_TABLECELL_CHAT_LIST          60
#define UI_SIZE_PIC_CHAT_LIST                 45
#define UI_TOP_PIC_CHAT_LIST                  7.5
#define UI_LEFT_PIC_CHAT_LIST                 7.5
#define UI_PIC_ROUND_RADIUS                   3

#define UI_HIGHT_TABLECELL_CONTACT            45
#define UI_HIGHT_TABLEHEADER_CONTACT          20
#define UI_SIZE_PIC_CONTACT                   30
#define UI_TOP_PIC_CONTACT                    7.5
#define UI_LEFT_PIC_CONTACT                   7.5
#define UI_RIGHT_PIC_CONTACT                  15


#define UI_HIGHT_TABLECELL_ME_PIC             75
#define UI_HIGHT_TABLECELL_ME_ITEM            44
#define UI_SIZE_ME_PIC                        55
#define UI_LEFT_ME_PIC                        10
#define UI_TOP_ME_PIC                         10
#define UI_SPACE_ME_GROUP                     10
#define UI_FONT_ME_NAME                       16


#define UI_SPACE_LEFT_TABLECELL               15
#define UI_SIZE_APP_ICON                      50
#define UI_SIZE_APP_ITEM                      83.3
#define UI_TOP_APP_ITEM                       10
#define UI_LEFT_APP_ITEM                      7.5

#define UI_PIC_SIZE_TWO_ROWS                  45
#define UI_PIC_TOP_TOW_ROWS                   10
#define UI_PIC_LEFT_TOW_ROWS                  7.5
#define UI_CHARACTER_LEFT_TWO_ROWS            12
#define UI_CHARACTER_RIGHT_TROW_ROWS          7.5

#define UI_TABLEVIEW_HIGHT_ONE_ROW            45
#define UI_PIC_SIZE_ONE_ROW                   30
#define UI_PIC_TOP_ONE_ROW                    7.5
#define UI_PIC_LEFT_NOE_ROW                   7.5
#define UI_CHARACTER_LEFT_ONE_ROW             12
#define UI_CHARACTER_RIGHT_ONE_ROW            7.5


#define UI_SPACE_APP_ICON                     9

#define UI_FONT_VC_MAIN_TITLE                 17
#define UI_FONT_VC_RIGHT_BUTTION              14
#define UI_FONT_TABLE_VIEW_UP                 14
#define UI_FONT_TABLE_VIEW_MID


#define UI_专业性

//-------------------------------------------------------------------------------------------------------------
//
// 常用
//
//-------------------------------------------------------------------------------------------------------------
#define ZYTextAlignment NSTextAlignment
#define ZYTextAlignmentCenter NSTextAlignmentCenter
#define ZYTextAlignmentLeft NSTextAlignmentLeft
#define ZYTextAlignmentRight NSTextAlignmentRight

#define ZYLineBreakMode NSLineBreakMode
#define ZYLineBreakByWordWrapping NSLineBreakByWordWrapping
#define ZYLineBreakByCharWrapping NSLineBreakByCharWrapping
#define ZYLineBreakByClipping NSLineBreakByClipping
#define ZYLineBreakByTruncatingHead NSLineBreakByTruncatingHead
#define ZYLineBreakByTruncatingTail NSLineBreakByTruncatingTail
#define ZYLineBreakByTruncatingMiddle NSLineBreakByTruncatingMiddle

#define ZYdispatch_release(a)

#define XH_STRETCH_IMAGE(image, edgeInsets) [image resizableImageWithCapInsets:edgeInsets resizingMode:UIImageResizingModeStretch]


#define RGBA(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a]
#define RGBCOLOR(a,b,c) RGBA(a,b,c,1.0)
#define XRGB(r,g,b)         [UIColor colorWithRed:(0x##r)/255.0 green:(0x##g)/255.0 blue:(0x##b)/255.0 alpha:1]
#define strIsEmpty(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length]<1 ? YES : NO )
#define ZYIsNullOrEmpty(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1)
#define ZYReplaceNULL2Empty(str)        ((nil == (str)) ? @"" : (str))
#define ZYReplaceEmpty2NULL(str)        ((nil == (str)) ? [NSNull null] : (str))
#define ZYReplaceNULL2HoriLine(str)     ((nil == (str)) ? @"--" : (str))

#define ZYScreenBounds                  [[UIScreen mainScreen] bounds]
#define ZYScreenFrame                   [[UIScreen mainScreen] applicationFrame]
#define ZYAppWidth                      [[UIScreen mainScreen] bounds].size.width
#define ZYAppHeight                     [[UIScreen mainScreen] bounds].size.height

#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

#define EQUAL_TO(a,v)                  ([a compare:v options:NSNumericSearch] == NSOrderedSame)
#define GREATER_THAN(a,v)              ([a compare:v options:NSNumericSearch] == NSOrderedDescending)
#define GREATER_THAN_OR_EQUAL_TO(a,v)  ([a compare:v options:NSNumericSearch] != NSOrderedAscending)
#define LESS_THAN(a,v)                 ([a compare:v options:NSNumericSearch] == NSOrderedAscending)
#define LESS_THAN_OR_EQUAL_TO(a,v)     ([a compare:v options:NSNumericSearch] != NSOrderedDescending)

#define kScreenWidthScale (ZYAppWidth / 320.0)
#define kScreenHeightScale (ZYAppHeight / 480.0)

#define UserDefaultStandard             [NSUserDefaults standardUserDefaults]


#define ZYSliderBarHeight               44.0

#define KTableViewCellLineColor RGBCOLOR(200, 199, 204) //分割线颜色

#define KTableCellLeftMarginWithImage 60.f  //  ios7group有图片

#define KTableCellPlainLeftMargin  15.0 //
#define kTableCellHeightNormal 44
#define kTableCellHeightNormal1 44

#define kPasteBoardPicKey @"kPasteBoardPicKey"
#define kPasteBoardThumbKey  @"kPasteBoardThumbKey"

//每页条数
#define STPageCount   20
//-------------------------------------------------------------------------------------------------------------
//
// 编译前修改参数
//
//-------------------------------------------------------------------------------------------------------------
#define kSSApplink @"https://itunes.apple.com/cn/app/gu-hai-zheng-ba/id824751470?ls=1&mt=8"
#define kSSURL @"simulationstock://come.hcdl.simulationstock"
#define kURL_PingFen @"itms-apps://itunes.apple.com/app/id824751470?at=10l6dK"
#define kURL_applink @"https://itunes.apple.com/cn/app/gu-hai-zheng-ba/id824751470?ls=1&mt=8"

#define DICTIONARY_LOG			//  日志开关

#ifndef DICTIONARY_LOG
#define Log(...)
#else
#define TMPCODEEABLE  // 测试的代码,数据
#endif

//-------------------------------------------------------------------------------------------------------------
//
// 数据持久化
//
//-------------------------------------------------------------------------------------------------------------
#define kUserDefaultLoginVCCheckboxSelectedState @"kUserDefaultLoginVCCheckboxSelectedState" //登录界面 保存用户名框选择状态


#define kSTSettingFilename @"kSTSettingFilename"
#define kSTSetting_uuid @"kSTSetting_uuid"
#define kSettingFileName_Group @"kSettingFileName_Group"
#define kSettingFileName_Group_notify @"kSettingFileName_Group_notify"
#define kSettingFileName_Group_file @"kSettingFileName_Group_file"
#define kSettingFileName_Group_people @"kSettingFileName_Group_people"
#define kSettingFileName_YunPan @"kSettingFileName_YunPan"
#define kSettingFileName_YunPan_file @"kSettingFileName_YunPan_file"

#define kSettingFileName_ToDo_List @"kSettingFileName_ToDo_List"
#define kSettingFileName_ToDo_Detail @"kSettingFileName_ToDo_Detail"

#define kSettingFileName_News_List @"kSettingFileName_News_List"
#define kSettingFileName_News_Detail @"kSettingFileName_News_Detail"


#define kSettingFileName_Colleagues @"kSettingFileName_Colleagues"
#define kSettingFileName_Colleagues_file @"kSettingFileName_Colleagues_file"

#define kNotificationLogin     @"kNotificationLogin"
#define kNotificationQuitLogin @"kNotificationQuitLogin"
#define kNotificationFocus @"kNotificationFocus"
#define kNotificationBeginFocus @"kNotificationBeginFocus"
#define kNotificationEndFocus @"kNotificationEndFocus"

#define kUserDefaultLoginState @"kUserDefaultLoginState"
#define kUserDefaultLoginKeepState @"kUserDefaultLoginKeepState"
#define kUserDefaultArrUser    @"kUserDefaultArrUser"
#define kUserDefaultDateXiaoXi @"kUserDefaultDateXiaoXi"
#define kUserDefaultDateGaoShou @"kUserDefaultDateGaoShou"

#define kNoticeFileName_PostNotice @"kNoticeFileName_PostNotice"
#define kNoticeFileName_PostNotice_File @"kNoticeFileName_PostNotice_File"

#define kUserDefaultStampId @"kUserDefaultStampId"
#define kUserDefaultDeviceToken @"kUserDefaultDeviceToken"



//-------------------------------------------------------------------------------------------------------------
//
// 通知
//
//-------------------------------------------------------------------------------------------------------------

#define kNotify_UpdateAllCodeComplete @"kNotify_UpdateAllCodeComplete"
#define kNotify_PingLunGuangChang @"kNotify_PingLunGuangChang"
#define kNotify_UpdateProductComplete @"kNotify_UpdateProductComplete"
#define kNotify_getAppVersionComplite @"kNotify_getAppVersionComplite"
#define kNotify_SliderViewRepressed @"kNotify_SliderViewRepressed"
#define kNotify_modifyUserInfo @"kNotify_modifyUserInfo"

#define kNotify_MsgXiaoXiUnReadRefresh  @"kNotify_MsgXiaoXiUnReadRefresh"
#define kNotify_MsgGaoShouUnReadRefresh  @"kNotify_MsgGaoShouUnReadRefresh"


#define kImageFinishedDownload @"ImageFinishedDownload"
#define kCJNotify_GetFreshProgress @"kCJNotify_GetFreshProgress"
#define kCJNotify_GetFreshState @"kCJNotify_GetFreshState"
#define kDataFinishedDownload @"kDataFinishedDownload"

#define socketLastingMessageNotify @"socketLastingMessageNotify" //长连接接收数据通知
#define kCJNotify_GetNewMessage @"kCJNotify_GetNewMessage"

#define IM_NOTIFY_RESEND_MESSAGE @"IM_NOTIFY_RESEND_MESSAGE" //重新发送消息

#define NOTIFICATION_DELETEGROUPCONTACT_BYUSERID @"NOTIFICATION_DELETEGROUPCONTACT_BYUSERID"


//-------------------------------------------------------------------------------------------------------------
//
// 常用颜色
//
//-------------------------------------------------------------------------------------------------------------
#define KTableViewCellTextColor RGBCOLOR(38, 38, 38)  //cell文字颜色，偏黑
#define KTableViewCellTextColorGray RGBCOLOR(128, 128, 128)  //cell文字颜色，偏灰

#define kOpenetListBackgroundColor [UIColor colorWithWhite:251/255.0 alpha:1.0]
#define kOpenetViewBackgroundColor [UIColor colorWithWhite:243/255.0 alpha:1.0]

//add by fuhao
#define BACKGROUNDGARY RGBCOLOR(246, 246, 246)

#endif
